import {
  base_url
} from "./config";

export function get(options) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: base_url + options.url,
      header: options.header,
      method: 'GET',
      data: options.data,
      success: res => {
        resolve(res.data);
      },
      fail: res => {
        reject(res.data);
      }
    })
  })
}

export function post(options) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: base_url + options.url,
      header: options.header,
      method: 'POST',
      data: options.data,
      success: (res) => {
        resolve(res.data);
      },
      fail: (res) => {
        reject(res.data);
      }
    })
  })
}